package com.example.Test1;

import com.example.dao.User;
import com.example.service.UserService;
import com.example.service.impl.UserServiceImpl;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 22044133 左立志
 * @data 2025/3/6 11:48
 */
public class SelectTest {
    @Test
    public void selectAll(){
        UserServiceImpl userService = new UserServiceImpl();
        List<User> users = userService.SelectAllUser();
        System.out.println(users);
    }
    @Test
    public void selectById(){
        UserServiceImpl userService = new UserServiceImpl();
        User user = userService.SelectById(2);
        System.out.println(user);
    }
    @Test
    public void updateId(){
        User user = new User(22, "123", "456");
        UserServiceImpl userService = new UserServiceImpl();
        userService.UpdateUser(user);
    }
    @Test
    public void selectCondition(){
        User user = new User(22,"123","456");
        UserService userService = new UserServiceImpl();
        User user1 = userService.selectOne(user);
        System.out.println(user1);
    }
    @Test
    public void selectListId(){
        List<Integer> users = new ArrayList<>();
        users.add(1);
        users.add(2);
        users.add(3);
        UserService userService = new UserServiceImpl();
        List<User> users1 = userService.selectListId(users);
        for(User u:users1)
            System.out.println(u);
    }
}
